<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "activity_discount".
 *
 * @property int $id
 * @property int $good_id 商品id
 * @property string $price_origin 商品原价
 * @property string $price_new 商品优惠价
 * @property int $start_at 开始时间
 * @property int $end_at 结束时间
 * @property int $status 状态
 * @property int $created_at 创建时间
 */
class ActivityDiscount extends Base
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'activity_discount';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['good_id', 'start_at', 'end_at', 'status', 'created_at'], 'integer'],
            [['price_origin', 'price_new'], 'number']
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'good_id' => 'Good ID',
            'price_origin' => 'Price Origin',
            'price_new' => 'Price New',
            'start_at' => 'Start At',
            'end_at' => 'End At',
            'status' => 'Status',
            'created_at' => 'Created At',
        ];
    }

    public function getGood(){
        return $this->hasOne(Good::class, ['id' => 'good_id']);
    }
}
